package cn.sail.mybatis.service.impl;

import cn.sail.mybatis.dao.PermissionMapper;
import cn.sail.mybatis.pojo.entity.Permission;
import cn.sail.mybatis.service.PermissionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
public class PermissionServiceImpl implements PermissionService {

    @Autowired
    private PermissionMapper permissionDao;

    @Override
    public void selectById(long id) {
        permissionDao.selectById(id);
    }

    @Transactional
    public void multipleSelectById(long id){
        permissionDao.selectById(id);
//        System.out.println("插入数据");
//        Permission permission = new Permission();
//        permission.setName("修改权限");
//        permissionDao.insert(permission);
        System.out.println("第二次查询");
        permissionDao.selectById(id);
    }

    @Override
    public void insert(Permission permission) {
        System.out.println("插入数据");
        permissionDao.insert(permission);
    }
}
